<script setup lang="ts">
import { ref } from 'vue'
const position = ref({
  x: 0,
  y: 0
})

const mousemove = (e: MouseEvent) => {
  position.value.x = e.pageX
  position.value.y = e.pageY
}
</script>
<template>
  <div>
    <p>x:{{ position.x }} y:{{position.y}}</p>
    <h1 @mousemove="mousemove">滑动到 h1 记录鼠标相对于窗口的位置</h1>
  </div>
</template>
